<!DOCTYPE html>
<html>
	<head>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="format-detection" content="telephone=no" />
		<meta charset="UTF-8">
		<title>身份认证</title>
		<link rel="stylesheet" href="https://unpkg.com/mint-ui/lib/style.css">
		<link rel="stylesheet" type="text/css" href="css/common/common.css"/>
		<link rel="stylesheet" type="text/css" href="css/authentication.css"/>
	</head>
	<body>
		<div id="authentication">
			<h3>身份认证</h3>
			<div class="authentication">
				<div class="name_number">
					<span>学号：</span>
					<input v-model="number" type="text" placeholder="请输入学号！"/>
				</div>
				<div class="name">
					<span>姓名：</span>
					<input v-model="name" type="text" placeholder="请输入姓名！"/>
				</div>
				<div class="sug-footer">
					<div class="button" @click="submitPost">提交</div>
				</div>
			</div>
		</div>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
		<script src="https://unpkg.com/mint-ui/lib/index.js"></script>
		<script src="js/vue-resource.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/common/common.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			new Vue({
				el:'#authentication',
				data:{
					name:'',
					number:''
				},
				created:function(){
					
				},
				methods:{
					submitPost:function(){
						var _self = this;
						var re = /^-?[1-9]\d*$/;
						if(!(re.test(_self.number)) || _self.number == ""){
							_self.$toast( '请输入正确的学号！');
						}else if(_self.name == ""){
							_self.$toast("姓名不能为空！")
						}else{
							var url = server_url + "a/zhtj/tyxx/checkInfo?xh=" + _self.number + "&xm=" + _self.name ;
							_self.$http.post(url).then(function(res){
								console.log(res);
								if(res.body.status == 0){
									var msg = res.body.msg;
									localStorage.setItem("name",_self.name);
									localStorage.setItem("number",_self.number);
									this.$messagebox.alert(msg).then(function(){
										location.href = "suggest.html";
									})
								}
							})
						}
						console.log(_self.name)
					}
				}
			})
		</script>
	</body>
</html>
